package mapper

import (
    "fmt"
    "net/http"
    "github.com/gin-gonic/gin"
)
type Asset struct {
    ID    string `json:"id"`
    Owner string `json:"owner"`
    Name  string `json:"name"`
    Info  string `json:"info"`
}

// 资产上链
func (Asset) Create(c *gin.Context) {
    var asset Asset
    if err := c.ShouldBind(&asset); err != nil {
        fmt.Println("bind err:", err)
    }

    fmt.Println(asset)

    c.JSON(http.StatusOK, gin.H{
        "message": "success",
    })
}
// 查询资产
func (Asset) Query(c *gin.Context) {
    id := c.Query("id")

    c.JSON(200, gin.H{
        "message": id,
    })
}
// 转移资产
func (Asset) Transfer(c *gin.Context) {
    id := c.Query("id")
    owner := c.Query("owner")

    c.JSON(200, gin.H{
        "id":     id,
        "owner":  owner,
    })
}